{{ header }}{{ column_left }}
{% if (cke  and  not header) %}
  <!DOCTYPE html>
  <html dir="{{ direction?direction:'ltr' }} " lang="{{ lang?lang }} ">
  <head>
  <meta charset="UTF-8" />
  <title>{{ heading_title }} </title>
  <base href="{{ base }} " />

  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
  <script type="text/javascript" src="view/javascript/jquery/jquery-2.1.1.min.js"></script>

  
  <!-- Power Image Manager -->
  <link rel="stylesheet" href="view/javascript/jquery/jquery-ui-1.11.4.custom/jquery-ui.css" />
  <script src="view/javascript/jquery/jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
  <script type="text/javascript" src="view/javascript/pim/pim.min.js"></script>          
  <link rel="stylesheet" type="text/css" media="screen" href="view/stylesheet/pim/pim.min.css">
  <link rel="stylesheet" type="text/css" media="screen" href="view/stylesheet/pim/theme.css">
    {% if lang %} 
     <script type="text/javascript" src="view/javascript/pim/i18n/{{ lang }}.js"></script>  
    {% endif %}         	
  <!-- Power Image Manager -->        

  <script type="text/javascript" src="view/javascript/bootstrap/js/bootstrap.min.js"></script>
  <link href="view/javascript/bootstrap/opencart/opencart.css" type="text/css" rel="stylesheet" />
  <link href="view/javascript/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet" />
  <link href="view/javascript/summernote/summernote.css" rel="stylesheet" />
  <script type="text/javascript" src="view/javascript/summernote/summernote.js"></script>
  <script src="view/javascript/jquery/datetimepicker/moment.js" type="text/javascript"></script>
  <script src="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
  <link href="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen" />
  <link type="text/css" href="view/stylesheet/stylesheet.css" rel="stylesheet" media="screen" />  
  </head>
  <body>
{% endif %}
<div id="content">
  <div class="container-fluid">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> {{ heading_title }}</h3>
        <div class="btn-group pull-right">
            <button aria-hidden="true" data-dismiss="modal" class="close" id="pimClose" type="button">×</button>
        </div>
      </div>
      <div class="panel-body">
        <div id="pim"></div>      
      </div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function getUrlParam(paramName) {
    var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;
    var match = window.location.search.match(reParam) ;

    return (match && match.length > 1) ? match[1] : '' ;
}  
$().ready(function() {
  var funcNum = '';

  {% if (cke  and  cke != '') %}
    funcNum = getUrlParam('CKEditorFuncNum');
  {% endif %}  
  {% if (CKEditorFuncNum  and  CKEditorFuncNum != '') %}
    funcNum = {{ CKEditorFuncNum }}
  {% endif %}    
    
		var elf = $('#pim').elfinder({
			url : 'index.php?route=common/filemanager/connector&user_token={{user_token}}',  // connector URL (REQUIRED)
			lang : '{{ lang }}', /* Setup your language here! */
			dirimage: '{{ dirimage }}', 
			height: '{{ height }}',
      useBrowserHistory: false,
      uiOptions : {toolbar : [['home', 'back', 'forward'],['reload'],['mkdir', 'upload'],['open', 'download', 'getfile'],['info'],['quicklook'],['copy', 'cut', 'paste'],['rm'],['duplicate', 'rename', 'edit', 'resize'],['extract', 'archive', 'sort'],['search'],['view'],['help']]},		
      contextmenu: {navbar: ["open", "|", "copy", "cut", "paste", "duplicate", "|", "rm", "|", "info"],cwd: ["reload", "back", "|", "upload", "mkdir", "mkfile", "paste", "|", "sort", "|", "info"],files: ["getfile", "|", "open", "quicklook", "|", "download", "|", "copy", "cut", "paste", "duplicate", "|", "rm", "|", "edit", "rename", "resize", "|", "archive","extract", "|", "info"]},
      {% if target  and  thumb  and  target  and  thumb  %}
        getFileCallback : function(files, fm) {
          a = files.url;
					b = a.replace('{{ https_catalog }}','');	
					b = b.replace('{{ dirimage }}','');	
          var img = $('#{{ thumb }}').find('img');
          {% if target %}
						$('#{{ target }}').val(decodeURIComponent(b));
					{% endif %}
					
          
          var jorunal_is_unbelivable_piece_of_SHIT = img.attr('data-ng-src');
          if (typeof Journal2Config !== typeof undefined && Journal2Config !== false && angular !== typeof undefined && typeof jorunal_is_unbelivable_piece_of_SHIT !== typeof undefined && jorunal_is_unbelivable_piece_of_SHIT !== false) {
            img.attr('data-ng-src',a);
            img.attr('src',a);
            var currentElement = $('#{{ target }}');
            var scope = angular.element(currentElement).scope();
            scope.image = b;
            scope.$apply();
            $('#pimClose').click();
          } else {
            img.attr('src', files.tmb);
          }
          $('#modal-image').remove();
					$('.modal-backdrop').remove();
        }, 
      {% endif %} 
      {% if  cke  and  cke != '' %} 
        getFileCallback : function(file) {
          window.opener.CKEDITOR.tools.callFunction(funcNum, file.url)
          self.close();	
        },
        {% endif %} 
      {% if CKEditorFuncNum  and  CKEditorFuncNum != '' %} 
        getFileCallback : function(file) {
          window.CKEDITOR.tools.callFunction(funcNum,file.url);
          self.close();	
      		delete CKEditorFuncNum;
      		$('#modal-image').modal('hide');
      		$('#modal-image').remove();          
        },
        {% endif %}         
        
        
				{% if productmanager  and  productmanager != '' %} 
						getFileCallback : function(file) {
							var pr_id = $('body').attr('data-current-product-id');
							a = file.url;
							b = a.replace('{{ dirimage }}','');	
							b = b.replace('{{ https_catalog }}','');								
							doSave(pr_id, 'image',b );
							$('#modal-image').modal('hide');								
						},
				{% endif %} 
				
        commandsOptions : {
          getfile : {
            oncomplete : 'close',
          }
        }              
      
		}).elfinder('instance');


  });
  
//--></script>
{{ footer }}
{% if cke  and  cke != ''  and  not footer %}
</body>
</html>
{% endif %} 